package com.hnevc.netdemo;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class NetDemo {

	public static void main(String[] args) throws UnknownHostException {
		InetAddress address =InetAddress.getLocalHost();
		InetAddress remoteInet = InetAddress.getByName("www.baidu.com");
		System.out.println(address.getHostAddress());
		System.out.println(address.getHostName());
		System.out.println(remoteInet.getHostAddress());
		System.out.println(remoteInet.getHostName());
	}
}
